#ifndef _GM_GLOBAL_H_
#define _GM_GLOBAL_H_

#include <middleware/gm_api/skfapi.h>

#include "gm_defs.h"

extern char  g_szDeviceID[1024];

extern char  g_szOEMID[64];

void cosDevinfo2Devinfo(cosDevInfo cosInfo, DEVINFO &Info);

void Devinfo2cosDevinfo(DEVINFO Info, cosDevInfo &cosInfo);

int check_file_oper_rights(ULONG ulRights);

int check_symm_algid(ULONG ulAlgId);

int check_digest_algid( ULONG ulAlgId );

ULONG get_last_sw_err();

ULONG get_public_form_cert(ULONG ulCertType, BYTE *pcbCert, ULONG dwCertLen, BYTE *pstPubKeyBlob, ULONG *ulPubkeylen);

ULONG reverse_ecc_enveloped_keyblob(PENVELOPEDKEYBLOB pEnvelopedKeyBlob, BYTE *pByte, ULONG *ulBytelen);

ULONG reverse_rsa_private(RSAPRIVATEKEYBLOB *rsa, BYTE *pbRsa, ULONG *ulRsaLen);

ULONG reverse_ecc_cipher(PECCCIPHERBLOB pcipher, BYTE *pByte, ULONG *ulWrapedLen);

ULONG reverse_to_ecc_cipher(BYTE *pByte, ULONG ulByteSize, PECCCIPHERBLOB pcipher);

ULONG change_dev_auth_key(DEVHANDLE hDev, BYTE *pbKeyValue, ULONG ulKeyLen, ULONG ulKeySpec);

ULONG dev_auth(DEVHANDLE hDev, BYTE *pbAuthData, ULONG ulLen, ULONG ulKeySpec);

int reverse_sm3_key(BYTE *pucID, ULONG ulIDLen, ECCPUBLICKEYBLOB *ecc_pub, BYTE *pucOut);

int convert_alg_id(ULONG ulUserAlgId);
#endif//_GM_GLOBAL_H_